package com.stir.cgt.ajm.client;

import java.util.Vector;

import com.google.gwt.user.client.ui.CaptionPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;




/**Holds a Sort.java (buckets control)
 */
public class Test extends MyLayoutPanel {	
	private TreeData treeData;
	private Vector<BucketLabel> labels=new Vector<BucketLabel>();
	private FlowPanel fPanel = new FlowPanel();

	public Test(){
		initForm();
	}

	public void setData(TreeData td, boolean setDefaultImps){
		labels.add(new BucketLabel(new TreeLink(), this));
		labels.add(new BucketLabel(new TreeLink(), this));
		labels.add(new BucketLabel(new TreeLink(), this));
		labels.add(new BucketLabel(new TreeLink(), this));
		labels.add(new BucketLabel(new TreeLink(), this));
		labels.add(new BucketLabel(new TreeLink(), this));
		drawLabels();
		refresh();
	}

	private void drawLabels() {
		for (int i=0;i<labels.size();i++){
			fPanel.add(labels.get(i));
		}
	}

	private void setNastyLabels(Vector<TreeLink> v) {
		int i;
		for(i=0; i<v.size();i++){
			TreeLink link = v.elementAt(i);
			BucketLabel b = new BucketLabel(link,this);
			b.setNice(false);
			labels.addElement(b);
		}
	}

	private void setNiceLabels(Vector<TreeLink> v) {
		int i;
		for(i=0; i<v.size();i++){
			TreeLink link = v.elementAt(i);
			BucketLabel b = new BucketLabel(link,this);
			b.setNice(true);
			labels.addElement(b);
		}
	}

	public TreeData getTreeData(){
		return treeData;
	}


	private void initForm() {
		ScrollPanel sp = new ScrollPanel();
		sp.add(fPanel);
		add(sp);
	}

	public void setValue(String name, int imp){
	
	}

	@Override
	public void refresh() {
		clear();
		add(fPanel);
	}


}
